<?php

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/


use App\Http\Controllers\AuthController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\SpeakerController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;

/**
 * JWT 用户鉴权基础路由.
 * laravel-box定义.
 */
Route::group(
    [
        'prefix' => 'auth',
        'middleware' => ['allow', 'refresh']
    ],
    function ($router) {
        $router->post('logout', [AuthController::class, 'logout']);
        $router->post('refresh', [AuthController::class, 'refresh']);
        $router->post('me', [AuthController::class, 'me']);
        // 账户管理
        $router->post('home', [UserController::class, 'userHome']); // 会员主页

        // 投稿系统注册信息
        $router->post('system/account', [UserController::class, 'systemAccount']);

        // 近期订单
        $router->post('recent/order', [UserController::class, 'recentOrder']);

        $router->post('user', [UserController::class, 'getUserInfo']); // 个人信息
        $router->post('modifyUser', [UserController::class, 'modifyUserInfo']); // 修改个人信息
        $router->post('modifyPassword', [UserController::class, 'modifyPassword']); // 修改密码
        $router->post('modifyUserPhone', [UserController::class, 'modifyUserPhone']); // 修改密码

        // 发票记录
        $router->post('receipt/list', [UserController::class, 'receiptList']);
        // 可开票金额
        $router->get('receipt/amount', [UserController::class, 'receiptAmount']);
        // 申请发票
        $router->post('receipt/check', [UserController::class, 'checkReceipt']);
        // 提交申请开票信息
        $router->post('receipt/apply', [UserController::class, 'applyReceipt']);
        // 查看发票记录详情
        $router->post('receipt/detail', [UserController::class, 'getReceiptDetail']);

        // 发票信息列表
        $router->post('receiptInfo/list', [UserController::class, 'receiptInfoList']);
        // 添加、编辑发票信息
        $router->post('receiptInfo/modify', [UserController::class, 'updateOrCreateReceiptInfo']);
        // 发票信息详情
        $router->post('receiptInfo/detail', [UserController::class, 'receiptInfoDetail']);
        // 删除发票信息详情
        $router->post('receiptInfo/delete', [UserController::class, 'receiptInfoDelete']);
        // 设为默认开票信息
        $router->get('receiptInfo/setDefault', [UserController::class, 'receiptInfoSetDefault']);
        // 评价管理列表
        $router->post('eval/list', [UserController::class, 'getEvalList']);
        // 评价管理详情

        // 查看评价

    }
);


Route::group(
    [
        'prefix' => 'order',
        'middleware' => ['allow', 'refresh']
    ],
    function ($router) {
        // 订单管理
        $router->post('list', [UserController::class, 'getUserOrderList']); // 服务订单
        $router->post('detail', [UserController::class, 'getOrderDetail']); // 订单详情
        $router->post('cancellation', [UserController::class, 'cancellationOrder']); // 取消订单
        $router->post('evaluate', [UserController::class, 'evaluateOrder']); // 评价订单
        $router->post('accept', [UserController::class, 'acceptOrder']); // 验收订单（完成订单）

        // 上传补充资料
        $router->post('upload', [UserController::class, 'uploadOrderProfiles']);
    }
);

Route::group(
    [
        'prefix' => 'auth',
        'middleware' => ['allow'], // 允许跨域
    ],
    function ($router) {
        $router->post('login', [AuthController::class, 'login']);
        $router->post('register', [AuthController::class, 'register']);
        $router->post('forget', [AuthController::class, 'forgetPassword']); // 忘记密码
        $router->post('sms', [AuthController::class, 'sendCode']); // 发送验证码
        $router->post('upload', [AuthController::class, 'upload']); // 上传图片
        $router->get('test/pdf', [AuthController::class, 'testPdf']);
        $router->post('checkCode', [UserController::class, 'checkMessageCode']); // 检查验证码
        // 获取七牛云token
        $router->get('qiniuToken', [UserController::class, 'getQiniuToken']);
    }
);



Route::group(
    [
        'prefix' => 'home',
        'middleware' => ['allow'], // 允许跨域
    ],
    function ($router) {
        // 精选文章
        $router->get('articles', [HomeController::class, 'featuredArticles']);
        // 精选视频
        $router->get('video', [HomeController::class, 'featuredVideo']);
        // 信息资源
        $router->get('resources', [HomeController::class, 'informationResources']);
        // 信息资源详情
        $router->post('resources/detail', [HomeController::class, 'informationResourcesDetail']);
        // 助力作者发表高影响力文章
        $router->get('comment', [HomeController::class, 'comment']);

        // 客户反馈
        $router->get('feedback', [HomeController::class, 'feedback']);
        // 在线留言
        $router->post('leave-msg', [HomeController::class, 'leaveMsg']);
        // 期刊列表
        $router->post('journal-list', [HomeController::class, 'journalList']);
        // 期刊详情
        $router->post('journal-detail', [HomeController::class, 'journalDetail']);
        // 期刊分类
        $router->post('journal-cate', [HomeController::class, 'journalCate']);

        // 配置
        $router->get('config', [HomeController::class, 'getConfig']);

        $router->get('ads', [HomeController::class, 'getAds']);
        //
    }
);
